const request = (url, params) => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: url,
            data: params,
            header: {
                'content-type': 'application/json' // 默认值
            },
            method: 'GET',
            success: (res) => {
                if (res.statusCode === 200) {
                    resolve(res.data.data);
                } else {
                    wx.showModal({
                        title: '未处理的异常',
                        content: JSON.stringify(res),
                        confirmText: '确定'
                    });
                }
            },
            fail: (err) => {
                reject(err);
            }
        });
    });
};
export default request;
